from rest_framework import serializers
from goods.models import SpecificationOption, SPUSpecification


class OptionSerialzier(serializers.ModelSerializer):
    spec = serializers.StringRelatedField(read_only=True)
    spec_id = serializers.IntegerField()
    class Meta:
        model = SpecificationOption  # 规格选项表中的spec字段关联了规格表
        fields = "__all__"

class OptionSpecificationSerializer(serializers.ModelSerializer):
    class Meta:
        model = SPUSpecification
        fields = '__all__'